package pms.providers.contents;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;

import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;

import pms.util.dto.domain.MyModel;

public class MyContentProvider implements IStructuredContentProvider,
		PropertyChangeListener {
	private MyModel content;
	private final Viewer viewer;

	public MyContentProvider(Viewer viewer) {
		this.viewer = viewer;
		content = new MyModel();
	}

	@Override
	public Object[] getElements(Object inputElement) {
		return content.getPersons().toArray();
	}

	@Override
	public void dispose() {
	}

	@Override
	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
	}

	@Override
	public void propertyChange(PropertyChangeEvent arg0) {
		viewer.refresh();
	}
}
